/******************************************************************************/
#include "stdafx.h"
#include "Main.h"
/******************************************************************************/
STRUCT(ControlsClass , GuiObjs)
//{
   STRUCT(Window , ::Window)
   //{
      virtual void update(C GuiPC &gpc)
      {
         super::update(gpc);

         if(Gui.window()==this)
         {
            if(Kb.bp(KB_ESC) || Ms.bp(1))
            {
               Kb.eat();
               Ms.eat();
               fadeOut();
            }
            REPA(Touches)if(Touches[i].guiObj()==this && Touches[i].db())fadeOut();
         }
      }
   };

   Bool visible()
   {
      if(::Window *window=findWindow(S))return !window->hiding();
      return false;
   }

   void create()
   {
      replaceWindow<Window>(); load("gui/controls.gobj"); hide(); Gui+=T;
   }

   void toggleVisibility()
   {
      if(::Window *window=findWindow(S))window->fadeToggle();
   }
}Controls;
/******************************************************************************/
Bool ControlsVisible() {return Controls.visible         ();}
void ControlsCreate () {       Controls.create          ();}
void ControlsToggle () {       Controls.toggleVisibility();}
void ControlsHide   () {       Controls.hide            ();}
/******************************************************************************/
